Skip to content

Conversation

zdebanos
Copy link
Contributor

This commit marks the end of my GSoC 2025 project in the NuttX section.

Currently creating as a draft pull request.
I have agreed with Pavel Pisa to separate the library's dependancy named ulut from the shv-libs4c repository (located currently here https://github.com/silicon-heaven/shv-libs4c/tree/master/submodule). This will require more time for me. Also, I have discussed with Karel Koci from Elektroline a.s. about the posibilities of the exports of external libraries - something that I somehow solved in this commit: #3154.
In the end we have agreed that this should be considered as "hacking the whole Makefile system" and I should rather come up with a better solution, and thus I'm postponing it. Since I require the export for the GSoC, I'd be glad to leave it here as draft until I solve all the issues already mentioned.

I am about to add documentation into the nuttx repo, too.

Summary

Please look into the commit's verbose message :-).

Impact

Adds the Silicon Heaven protocol implementation. A framework designed to register your callbacks into your application. The callbacks are organized into nodes and the nodes can form a tree structure.

Testing

The testing was done on my custom samv7 board. In nuttx:
tools/configure.sh myboard/myconfig - configuration OK
make - downloads the shv-libs4c repo from github, and compiles OK

DISCLAIMER: in my GSoC, I was using make export. But with the solution used here (https://github.com/zdebanos/pysimCoder/tree/shv-refactor) I succesfully compiled against automatically generated source code in pysimCoder.

@cederom cederom moved this to In Progress in Apache NuttX GSoC Aug 31, 2025
@cederom cederom changed the title Add Silicon Heaven protocol adaptation into NuttX and SHV examples [GSoC2025] Add Silicon Heaven protocol adaptation into NuttX and SHV examples Aug 31, 2025
@zdebanos zdebanos force-pushed the gsoc2025-shv-libs4c-final branch 2 times, most recently from ad61dea to 12f3c4f Compare September 1, 2025 00:35
@zdebanos zdebanos force-pushed the gsoc2025-shv-libs4c-final branch 5 times, most recently from b657b39 to a6ede5f Compare September 2, 2025 13:35
@zdebanos
Copy link
Contributor Author

zdebanos commented Sep 2, 2025

I came across an issue, which must be fixed: locally, I was running against pyshv==0.7.3 (implementation of Silicon Heaven API in python) but when I added requirements and changed the imports to match with pyshv==0.10.0, it stopped working, probably by using a bad function of some sort. I'll have to look deeper into that.

All i know is that the script worked with the previous version, the target device functionality has not changed.

@simbit18
Copy link
Contributor

simbit18 commented Sep 2, 2025

would reformat /home/runner/work/nuttx-apps/nuttx-apps/apps/examples/shv-nxboot-updater/update-script/gui.py

Oh no! 💥 💔 💥
1 file would be reformatted.

black check failed, run following command to update the style:
  $ black <src>

@zdebanos
Copy link
Contributor Author

zdebanos commented Sep 2, 2025

@simbit18 I know about that, I'm working on a different fix and I'm gonna fix the linter error too.

@zdebanos
Copy link
Contributor Author

zdebanos commented Sep 2, 2025

I also need to address the shv-libs4c correct version. I've got two options I can implement:

  1. download a correct .zip from github releases
  2. clone a "specific hash" commit and compile against it

I'm in favor with the second option. That means I'll have to specify the commit hash inside the Makefile.

Currently, I'm running against master as it's still draft and I'm fixing last errors. Then I'll specify the correct version.

…xamples

This commit marks the end of my GSoC 2025 project in the NuttX section.
All changes:

- Silicon Heaven protocol (SHV) implementation:
  The library is cloned from github.com/silicon-heaven/shv-libs4c
  and compiled here. The library has out-of-the-box support
  for NuttX and possibly all posix systems.
  The library is compiled with CONFIG_SHV_LIBS4C_PLATFORM define
  set to "nuttx". The library's dependancy is Pavel Pisa's ULUT
  and originates from Michal Lenc's GSoC.

- examples/shv-nxboot-updater:
  An example which constructs a SHV tree with which you can perform
  firmware updates using a SHV "file node". The file node wraps
  around NXBoot's update partition.
  The application also allows for NXBoot confirmation of the images.
  This application is to be meant used as a "background service",
  started before any apps, possibly using rcS. The tree is allocated
  as GAVL (see below).

- examples/shv-test:
  An example which constructs a SHV tree and gives the user
  the ability to choose which type of construction should be used,
  either:
    - GAVL:       dynamic SHV tree allocation encapsulated within
                  an AVL tree.
    - GSA:        dynamic SHV tree allocation encapsulated within
                  a continuous array with binary search
    - GSA_STATIC: SHV tree is defined as static const, this means
                  all the data structures are placed in .rodata.
		  Extremely beneficial for embedded systems,
		  as .rodata is located in flash and embedded
		  systems usually have more flash than sram,
		  thus reducing sram usage. The downside is that
		  the definitions are rather tedious, but can
		  be automated in case of some code generation
		  (like in pysimCoder).
		  All of it is places in a continuous array with
		  binary search.

Signed-off-by: Stepan Pressl <[email protected]>
@zdebanos zdebanos force-pushed the gsoc2025-shv-libs4c-final branch from a6ede5f to 39ec06f Compare September 2, 2025 16:31
@michallenc
Copy link
Contributor

I also need to address the shv-libs4c correct version. I've got two options I can implement:

1. download a correct .zip from github releases

2. clone a "specific hash" commit and compile against it

I'm in favor with the second option. That means I'll have to specify the commit hash inside the Makefile.

Currently, I'm running against master as it's still draft and I'm fixing last errors. Then I'll specify the correct version.

I am also for the second option. The commit hash can even be a configurable option in Kconfig to easily allow the change of a version per project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

4 participants